require ['knockout', 'adFloat','jquery','bootstrap'], (ko, adFloat, $) ->
  ko.components.register 'ad-float', adFloat
  class viewModel
    constructor: ->
  ko.applyBindings new viewModel()
  $ ->
    $('.tab .text').click ->
      t1 = $('.tab1')
      t2 = $('.tab2')
      i = $(this).index() + 1
      $('.tabC').removeClass 'active'
      show = if i == 1 then t1 else t2
      show.addClass 'active'
      $('.tab .text').removeClass 'active'
      $(this).addClass 'active'
      return
    $('.select_1').click ->
      $(this).find('.option').toggle()
      return
    for i in $('.center_list td[time]')
      t = $(i).attr('time')
      hour = parseInt(t/3600)
      min = parseInt((t-hour*3600)/60)
      sec = parseInt(t-hour*3600-min*60)
      $(i).html(hour+'时'+min+'分'+sec+'秒')
    getQueryString = (name) ->
      reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
      r = window.location.search.substr(1).match(reg)
      if r != null
        return unescape(r[2])
      ''
    $('#searchBoxInput').keydown (e)->
      curKey = e.which
      if curKey == 13
        val = $(this).parent('.searchBox').find('input').val()
        location.href = '?pageSize='+getQueryString('pageSize')+'&filterStatus='+getQueryString('filterStatus')+'&filterJob='+getQueryString('filterJob')+'&filterUserName='+val
      return
    $('#searchBoxCtrl').click ->
      val = $(this).parent('.searchBox').find('input').val()
      location.href = '?pageSize='+getQueryString('pageSize')+'&filterStatus='+getQueryString('filterStatus')+'&filterJob='+getQueryString('filterJob')+'&filterUserName='+val
      return
    return